#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N];
vector<int> mak;
int main() {
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    int n;
    long long ans = 0;
    cin >> n;
    int in, mx = INT_MIN;
    for (int i = 1; i <= n; i++) {
        cin >> in;
        a[in]++;
        mx = max(in, mx);
    }
    bool first = false;
    for (int i = 1; i <= mx; i++) {
        if (a[i] != 0) {
            if (!first) {
                for (int j = 1; j <= a[i]; j++)
                    mak.push_back(i);
                first = true;
                continue;
            }
            ans += min(a[i], int(mak.size()));
            for (int j = 1; j <= min(a[i], int(mak.size())); j++) {
                mak.pop_back();
            }
            for (int j = 1; j <= a[i]; j++)
                    mak.push_back(i);
        }
    }
    cout << n - ans << endl;
    return 0;
}
